//
//  ViewController.m
//  LGPhotoEditer
//
//  Created by Arrcen-LG on 2018/12/3.
//  Copyright © 2018 Arrcen-LG. All rights reserved.
//

#import "ViewController.h"
#import "LGPhotoEditerViewController.h"

@interface ViewController ()<LGPhotoEditerViewControllerDelegate>

@property(nonatomic,weak) IBOutlet UIImageView *imageView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

#pragma mark - Action

- (IBAction)handleEditPhoto:(id)sender {
    LGPhotoEditerViewController *vc = [[LGPhotoEditerViewController alloc] init];
    [vc setModalPresentationStyle:UIModalPresentationFullScreen];
    [vc setDelegate:self];
    [vc setOriginImage:[UIImage imageNamed:@"img"]];
    [self presentViewController:vc animated:YES completion:^{
        
    }];
}

#pragma mark - LGPhotoEditerViewControllerDelegate

- (void)didCancelPhotoEditer:(nonnull LGPhotoEditerViewController *)editer {
    [editer dismissViewControllerAnimated:YES completion:nil];
}

- (void)photoEditer:(nonnull LGPhotoEditerViewController *)editer didDoneWithImage:(nonnull UIImage *)image {
    NSLog(@"%@", NSStringFromCGSize(image.size));
    [self.imageView setImage:image];
    [editer dismissViewControllerAnimated:YES completion:nil];
}

@end
